<template>
  <div class="page-box">
    <div class="page-title fonsSizeTitle">考核季度：{{quarterInfo.quarter_name}}</div>
    <div class="score_con_box">
      <div class="item-con-user-name fonsSizeTitle">{{query.user_name}}自评 {{query.me_score}}分 {{gradeInit(query.me_score).gradeadd}}</div>
      <div class=" fonsSizeCon">部门：{{quarterInfo.dept_list}}</div>
      <div class=" fonsSizeCon">提交时间：{{query.create_time}}</div>
      <div v-if="quarterInfo.approval_score&&quarterInfo.approval_score.length" v-for="(item, index) of quarterInfo.approval_score " :key="index" class=" fonsSizeCon">
        {{sureMySelf(item.role_type)}}{{item.user_name}}{{byrole_typeText(item.role_type)}}:{{item.total_score}}分 <span v-if="item.role_type == '1'">{{item.score_level}}</span> </div>
      <!-- <div class=" fonsSizeCon">总评分 97分 A+</div> -->
    </div>

    <div class="rulePart-box">
      <div class="rulePart-box-title  fonsSizeTitle">价值观（占比40%）</div>
      <div v-for="(item,index) of senseOfWorth" :key="index" class="rulePart">
        <div class="rulePart-title fonsSizeConTitle">
          {{item.question_name}} (占比{{item.rare}}%)
        </div>
        <!-- :class="{'rulePart-con-hide':!item.showAll}" -->
        <div class="rulePart-con ">
          <van-field class="fonsSizeCon" readonly v-model.trim="item.task" type="textarea" placeholder="" rows="2" autosize />
        </div>
        <!-- <div @click="item.showAll=!item.showAll" class="rulePart-con-button">{{item.showAll?'收起':'展开'}}</div> -->
        <!-- v-if="initmarkListItem(markListItem.score_type)" -->
        <div v-for="(markListItem,markListIndex) of item.markList" :key="markListIndex" class="work">
          <van-cell-group>
            <van-field class="nf-field-input-left" :readonly="!markListItem.readonlyNo" v-model.trim="markListItem.messge" required clearable :label="`${sureMySelf(markListItem.role_type)}${markListItem.user_name||''}评价` " type="textarea" placeholder="请输入" rows="1" autosize />
          </van-cell-group>
          <van-cell-group>
            <van-field class="nf-field-input-left" @change="scoreChange('senseOfWorth',markListIndex,Number(markListItem.score),index)" :readonly="!markListItem.readonlyNo" required v-model.trim="markListItem.score" clearable :label="`${sureMySelf(markListItem.role_type)}${markListItem.user_name||''}评分`" type="number" placeholder="请输入1-100之间的数字">
            </van-field>
          </van-cell-group>
        </div>
      </div>
    </div>
    <div class="rulePart-box">
      <div class="rulePart-box-title  fonsSizeTitle">工作绩效（占比60%）</div>
      <div v-for="(item,index) of jobPerformance" :key="index" class="rulePart">
        <div class="rulePart-title fonsSizeConTitle">
          {{item.question_name}} (占比{{item.rare}}%)
        </div>
        <!-- :class="{'rulePart-con-hide':!item.showAll}" -->
        <div class="rulePart-con ">
          <van-field class="fonsSizeCon" readonly v-model.trim="item.task" type="textarea" placeholder="" rows="2" autosize />
        </div>
        <!-- <div @click="item.showAll=!item.showAll" class="rulePart-con-button">{{item.showAll?'收起':'展开'}}</div> -->
        <!-- v-if="initmarkListItem(markListItem.score_type)" -->
        <div v-for="(markListItem,markListIndex) of item.markList" :key="markListIndex" class="work">
          <van-cell-group>
            <van-field class="nf-field-input-left" :readonly="!markListItem.readonlyNo" v-model.trim="markListItem.messge" required clearable :label="`${sureMySelf(markListItem.role_type)}${markListItem.user_name||''}评价` " type="textarea" placeholder="请输入" rows="1" autosize />
          </van-cell-group>
          <van-cell-group>
            <van-field class="nf-field-input-left" @change="scoreChange('jobPerformance',markListIndex,Number(markListItem.score),index)" :readonly="!markListItem.readonlyNo" required v-model.trim="markListItem.score" clearable :label="`${sureMySelf(markListItem.role_type)}${markListItem.user_name||''}评分`" type="number" placeholder="请输入1-100之间的数字">
            </van-field>
          </van-cell-group>
        </div>
      </div>

      <div v-if="isMyApprove&&score_status" class="rulePart">
        <div class="work">
          <van-cell-group>
            <van-field v-model.trim="message" required clearable label="备注 " type="textarea" placeholder="请输入" rows="3" autosize />
          </van-cell-group>
        </div>
      </div>
    </div>

    <div v-if="quarterInfo.approval_process" style="margin-top:16px;" class="van-steps-box">
      <van-steps direction="vertical" :active="initProcessActive()">
        <van-step v-if="quarterInfo.approval_process.submitpsn">
          <h3>【{{quarterInfo.approval_process.submitpsn.name}}】发起申请</h3>
          <p>{{quarterInfo.approval_process.submitpsn.create_time}}</p>
        </van-step>
        <van-step v-for="(item,index) of quarterInfo.approval_process.scoreApprovepsn" :key="index" v-if="quarterInfo.approval_process.scoreApprovepsn.length">
          <h3>【{{item.name}}】{{approve_status[item.status||0].lable}} </h3>
          <p>{{item.create_time}}</p>
        </van-step>
      </van-steps>
    </div>
    <!--   也要看地方，不同时候在不同位置 -->
    <!-- v-if="isShowSumScore" 在评价阶段 各级都要显示总评分所以注释  isMyApprove 审批进来才看，自评上面有 sumScore.num 有值则表有改变 -->
    <div v-if="isMyApprove&&sumScore.num"  class="rulePart-box">
      <van-cell-group style="padding:22px 26px;color:#000" class="cenBet">
        <div v-if="role_type == '1'">
          总评分
        </div>
        <div v-else-if="role_type == '2'">
          工作绩效评分
        </div>
        <div v-else-if="role_type == '3'">
          价值观评分
        </div>
        <div v-else>
          评分
        </div>
        <div>
          <!-- 完整评价才显示等级 -->
          {{sumScore.num}}分 <span v-if="role_type == '1'">{{sumScore.grade.gradeadd}}</span>
        </div>
      </van-cell-group>
    </div>
    <div v-if="isMyApprove&&messageList.length" class="rulePart">
      <div class="work">
        <van-cell-group v-for="(messageItem,messageIndex) in messageList" :key='messageIndex'>
          <van-field class="nf-field-input-left" disabled v-model.trim="messageItem.message" required clearable :label="`${messageItem.name}备注 ` " type="textarea" placeholder="" rows="3" autosize />
        </van-cell-group>
      </div>
    </div>
    <div v-if="isMyApprove&&score_status" class="screen_fixed cenCen">
      <van-button @click="submitFrom()" class="cursor maxWidth" style="width:100%" icon="success" type="info">通过</van-button>
    </div>
  </div>
</template>
<script>
// 1：上级领导=》二部分评价评分，总评分，备注，通过操作(已评过则去掉,只读)
// 2：区域领导=》工作绩效评价评分，总评分，备注，通过操作(已评过则去掉,只读)
// 3：hr=》价值观部分评价评分，总评分，备注，通过操作(已评过则去掉,只读)
// 4：上上级领导待审核=》备注，通过操作(已评过则去掉,只读)
import service from "@/api";
import { grade } from "@/components/js/grade.js";
import approve_status from "@/components/js/approve_status"; //评分状态
export default {
  data() {
    return {
      is_appeal: 0, //下发的状态
      score_status: 0, //根据这个状态 0只能查看 1显示通过按钮
      scoreApproval_findByIdData: {},
      message: "", //备注
      messageList: [], //
      isShowSumScore: false, //是否显示总评分和等级
      role_type: "", //角色类型的值 1上级领导，2区域领导 3hr， 4审核领导
      is_score: 0, //是否评分 0 不评分，1评分
      approve_status: approve_status,
      isMyApprove: false, //是否从我的审批中进入的
      query: {},
      sumScore: {
        num: 0,
        grade: {}
      }, //总的
      senseOfWorth: [], //价值观部分
      jobPerformance: [], //工作绩效部分
      quarterInfo: {} //季度信息
    };
  },
  created() {
    this.query = this.$route.query;
    this.role_type = this.query.role_type;
    this.is_score = this.query.is_score;
    this.isMyApprove = this.query.isMyApprove || false;
    // console.log("===", this.query);
    this.initFun();
  },
  methods: {
    async initFun() {
      this.$store.state.loading = true;
      this.$store.state.loadingText = "获取数据中";
      if (this.isMyApprove) {
        // 审批评分详情
        // {"status":100,"msg":"SUCCESS","data":{"create_time":{"date":22,"hours":15,"seconds":14,"month":7,"nanos":0,"timezoneOffset":-480,"year":119,"minutes":29,"time":1566458954000,"day":4},"user_name":"南方","approve_status":0,"is_appeal":2,"portrait":"https://static-legacy.dingtalk.com/media/lADPDgQ9qbgf2GrNAxHNAkw_588_785.jpg","hiredate":"2018-01-01","quarter_id":13,"quarter_name":"2019-07—2019-09第三季度","dept_list":"[钉钉测试, 易捷云访客&悦门户, 筹备组]","examineList":[{"task":"（1）对客户负责，积极响应客户需求，即使不是自己的责任，也不推诿；\n（2）站在客户的立场思考问题，在坚持原则的基础上，最终达到客户和公司都满意；\n（3）微笑面对投诉和受到的委屈，积极主动地在工作中为客户解决问题；\n（4）尊重他人，随时随地维护斗象形象。\n     ","vnote2":"","create_time":{"date":22,"hours":15,"seconds":14,"month":7,"nanos":0,"timezoneOffset":-480,"year":119,"minutes":29,"time":1566458954000,"day":4},"question_type":1,"vnote3":"","question_name":"客户第一","rare":10,"vnote1":"","markList":[{"score":100,"messge":"客户第一 (占比10%)","create_time":"2019-08-22 16:05:00","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":11,"examineb_id":223,"score_type":0},{"score":100,"messge":"1","create_time":"2019-08-23 00:30:18","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":31,"examineb_id":223,"score_type":1}],"examine_id":29,"question_code":"","id":223},{"task":"（1）今天的事不推到明天，上班时间只做与工作有关的事情；\n（2）对待工作力求完美，勇于承担有挑战性的任务，遇到困难敢于攻关；\n（3）乐于创造、创新并付诸行动，并带来突破性地提高；\n（4）决策前充分讨论，决策后无条件执行；\n（5）持续学习，自我完善，做事情充分体现以结果为导向。\n      ","vnote2":"","create_time":{"date":22,"hours":15,"seconds":14,"month":7,"nanos":0,"timezoneOffset":-480,"year":119,"minutes":29,"time":1566458954000,"day":4},"question_type":1,"vnote3":"","question_name":"奋斗创新","rare":10,"vnote1":"","markList":[{"score":100,"messge":"奋斗创新 (占比10%)","create_time":"2019-08-22 16:05:00","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":12,"examineb_id":224,"score_type":0},{"score":100,"messge":"2","create_time":"2019-08-23 00:30:18","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":32,"examineb_id":224,"score_type":1}],"examine_id":29,"question_code":"1","id":224},{"task":"（1）积极溶入团队、乐于助人，团队战斗共进退；\n（2）对兄弟团队负责，勇于承担责任，积极参与跨团队协作；\n（3）对事认真，对人坦诚，工作中“对事不对人”；\n（4）有主人翁意识，积极正面地影响团队；\n（5）顾全大局，不计较个人得失。\n    ","vnote2":"","create_time":{"date":22,"hours":15,"seconds":14,"month":7,"nanos":0,"timezoneOffset":-480,"year":119,"minutes":29,"time":1566458954000,"day":4},"question_type":1,"vnote3":"","question_name":"团队精神","rare":10,"vnote1":"","markList":[{"score":100,"messge":"团队精神 (占比10%)","create_time":"2019-08-22 16:05:00","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":13,"examineb_id":225,"score_type":0},{"score":80,"messge":"3","create_time":"2019-08-23 00:30:18","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":33,"examineb_id":225,"score_type":1}],"examine_id":29,"question_code":"2","id":225},{"task":"（1）关注公司发展，积极参加公司文化建设；\n（2）不传播未经证实的消息，不背后不负责任地议论事和人，并能正面引导，对于任何意见和反馈“有则改之，无则加勉”；\n（3）对工作中发生的困难和挫折，能自我调整，并正面影响和带动同事；\n（4）对损害公司利益的不诚信行为正确有效地制止。\n    ","vnote2":"","create_time":{"date":22,"hours":15,"seconds":14,"month":7,"nanos":0,"timezoneOffset":-480,"year":119,"minutes":29,"time":1566458954000,"day":4},"question_type":1,"vnote3":"","question_name":"使命感","rare":10,"vnote1":"","markList":[{"score":100,"messge":"使命感 (占比10%)","create_time":"2019-08-22 16:05:00","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":14,"examineb_id":226,"score_type":0},{"score":100,"messge":"4","create_time":"2019-08-23 00:30:18","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":34,"examineb_id":226,"score_type":1}],"examine_id":29,"question_code":"3","id":226},{"task":"考核内容","vnote2":"","create_time":{"date":22,"hours":15,"seconds":14,"month":7,"nanos":0,"timezoneOffset":-480,"year":119,"minutes":29,"time":1566458954000,"day":4},"question_type":2,"vnote3":"","question_name":"工作绩效考核标准","rare":60,"vnote1":"","markList":[{"score":100,"messge":"工作绩效考核标准 (占比60%)","create_time":"2019-08-22 16:05:00","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":15,"examineb_id":227,"score_type":0},{"score":100,"messge":"5","create_time":"2019-08-23 00:30:18","user_id":"103612431737659018","user_name":"南方","examine_id":29,"id":35,"examineb_id":227,"score_type":1}],"examine_id":29,"question_code":"4","id":227}],"user_id":"103612431737659018","is_confirm":0,"approval_process":{"scoreApprovepsn":[{"auditorId":"103612431737659018","create_time":"2019-08-23 00:30:21","name":"南方","status":1},{"auditorId":"283964326521341120","name":"卜晓南"},{"auditorId":"16311461462725869","name":"Xiie"}],"approvepsn":[{"auditorId":"283964326521341120","create_time":"2019-08-22 15:55:38","name":"卜晓南","status":1}],"submitpsn":{"auditorId":"103612431737659018","create_time":"2019-08-22 15:29:14.0","name":"南方","status":1}},"id":29,"is_note":1,"me_score":200.00,"status":1}}
        const { data = {} } = await service.scoreApproval_findById({
          recordId: this.query.recordId,
          examine_id: this.query.id
        });
        // this.score_status = data.score_status;
        this.renderData(data);
        // 备注
        const performance_findMessageById = await service.performance_findMessageById(
          {
            id: this.query.id
          }
        );
        if (performance_findMessageById.data) {
          this.messageList = performance_findMessageById.data.rows || [];
        }
      } else {
        // 自评评分详情
        const { data = {} } = await service.score_findById({
          recordId: this.query.recordId || null,
          examine_id: this.query.id
        });
        this.renderData(data);
      }
      this.$store.state.loading = false;

      // this.score_findById();
    },
    // 初始化状态，下发分数之前只能看到自己的
    initmarkListItem(score_type) {
      if (this.is_appeal == 4) {
        // 如果以下发分数则直接可以看见
        return true;
      } else if (this.is_appeal != 4 && score_type == 1) {
        //如果没有下发分数，且是他人评分则不可见
        return false;
      } else if (this.is_appeal != 4 && score_type == 0) {
        //如果没有下发分数，且是自己评分则可见
        return true;
      } else {
        // 特殊情况也见算了
        return true;
      }
    },
    async renderData(data) {
      this.score_status = data.score_status || 0;
      this.quarterInfo = JSON.parse(JSON.stringify(data));
      this.is_appeal = data.is_appeal || 0;
      // console.log("--=", data);
      if (
        this.quarterInfo.approval_process &&
        this.quarterInfo.approval_process.scoreApprovepsn.length
      ) {
        this.quarterInfo.approval_process.scoreApprovepsn = [];
        // 审批已拒绝后面不显示
        for (let i = 0; i < data.approval_process.scoreApprovepsn.length; i++) {
          if (data.approval_process.scoreApprovepsn[i].status == 2) {
            this.quarterInfo.approval_process.scoreApprovepsn.push(
              data.approval_process.scoreApprovepsn[i]
            );
            break;
          }
          this.quarterInfo.approval_process.scoreApprovepsn.push(
            data.approval_process.scoreApprovepsn[i]
          );
        }
      }

      if (data.examineList.length) {
        this.senseOfWorth = [];
        this.jobPerformance = [];
        data.examineList.map(item => {
          // console.log(item.markList);
          if (item.question_type == 1) {
            // 价值观部分
            let obj = {
              ...item,
              showAll: false
            };
            this.senseOfWorth.push(obj);
          } else {
            // 工作绩效部分
            let obj = {
              ...item,
              showAll: false
            };
            this.jobPerformance.push(obj);
          }
        });

        if (this.is_score == 1 && this.score_status == 1) {
          //是否评分 0 不评分，1评分,如果是可以评分的则增加评分的字段和填写地方
          this.isShowSumScore = true;
          // 角色类型的值 1上级领导，2区域领导 3hr， 4审核领导
          if (this.role_type == "1") {
            // 上级领导=》二部分评价评分，总评分，备注，通过操作(已评过则去掉,只读)
            this.senseOfWorth.map(item => {
              item.markList.push({
                messge: "",
                score: "",
                role_type: 1,
                readonlyNo: true //不是只读
              });
            });
            this.jobPerformance.map(item => {
              item.markList.push({
                messge: "",
                score: "",
                role_type: 1,
                readonlyNo: true //不是只读
              });
            });
          } else if (this.role_type == "2") {
            // 2：区域领导=》工作绩效评价评分，总评分，备注，通过操作(已评过则去掉,只读)
            this.jobPerformance.map(item => {
              item.markList.push({
                messge: "",
                score: "",
                role_type: 2,
                readonlyNo: true //不是只读
              });
            });
          } else if (this.role_type == "3") {
            // 3：hr=》价值观部分评价评分，总评分，备注，通过操作(已评过则去掉,只读)
            this.senseOfWorth.map(item => {
              item.markList.push({
                messge: "",
                score: "",
                role_type: 3,
                readonlyNo: true //不是只读
              });
            });
          } else if (this.role_type == "4") {
            this.isShowSumScore = false;
            // 4：上上级领导待审核=》备注，通过操作(已评过则去掉,只读)
          }
        }
      }
      // console.log(this.quarterInfo);
    },
    byrole_typeText(role_type) {
      if (role_type == "1") {
        return "总评分";
      } else if (role_type == "2") {
        return "工作绩效评分";
      } else if (role_type == "3") {
        return "价值观评分";
      } else {
        return "评分";
      }
    },
    // 确定身份
    sureMySelf(role_type) {
      if (role_type == 1) {
        return "上级领导/";
      } else if (role_type == 2) {
        return "区域领导/";
      } else if (role_type == 3) {
        return "hr/";
      } else {
        return "";
      }
    },
    // 计算总分
    scoreChange(who, markListIndex, score, index) {
      if (score < 1 || score > 100) {
        this.$toast.fail(`请输入1-100之间的数字`);
        if (who == "senseOfWorth") {
          this.senseOfWorth[index].markList[markListIndex].score = 1;
        }
        if (who == "jobPerformance") {
          this.jobPerformance[index].markList[markListIndex].score = 1;
        }
      }

      // 计算总分和等级
      if (this.role_type == "1") {
        // 上级领导评价二部分

        // 价值观
        let senseOfWorthNum = 0;
        this.senseOfWorth.map((item, index) => {
          let itemNum = 0; //每一项放分数
          item.markList.map((markListItem, markListIndex) => {
            if (markListItem.readonlyNo) {
              itemNum =
                (Number(markListItem.score) || 0) *
                (item.rare / 100).toFixed(4); //评价分数*占比
            }
          });
          senseOfWorthNum += itemNum;
        });

        // 工作绩效
        let jobPerformanceNum = 0;
        this.jobPerformance.map((item, index) => {
          let itemNum = 0; //每一项放分数
          item.markList.map((markListItem, markListIndex) => {
            if (markListItem.readonlyNo) {
              itemNum =
                (Number(markListItem.score) || 0) *
                (item.rare / 100).toFixed(4); //评价分数*占比
            }
          });
          jobPerformanceNum += itemNum;
        });

        //计算之和
        this.sumScore.num = (senseOfWorthNum + jobPerformanceNum).toFixed(1);
        this.sumScore.grade = grade(this.sumScore.num);
      } else if (this.role_type == "2") {
        // 区域领导=>工作绩效部分
        // 工作绩效
        let jobPerformanceNum = 0;
        this.jobPerformance.map((item, index) => {
          let itemNum = 0; //每一项放分数
          item.markList.map((markListItem, markListIndex) => {
            if (markListItem.readonlyNo) {
              itemNum =
                (Number(markListItem.score) || 0) *
                (item.rare / 100).toFixed(4); //评价分数*占比
            }
          });
          jobPerformanceNum += itemNum;
        });

        //计算之和
        this.sumScore.num = jobPerformanceNum.toFixed(1);
        this.sumScore.grade = grade(this.sumScore.num);
      } else if (this.role_type == "3") {
        // hr=》价值观部分
        // 价值观
        let senseOfWorthNum = 0;
        this.senseOfWorth.map((item, index) => {
          let itemNum = 0; //每一项放分数
          item.markList.map((markListItem, markListIndex) => {
            if (markListItem.readonlyNo) {
              itemNum =
                (Number(markListItem.score) || 0) *
                (item.rare / 100).toFixed(4); //评价分数*占比
            }
          });
          senseOfWorthNum += itemNum;
        });
        this.sumScore.num = senseOfWorthNum.toFixed(1);
        this.sumScore.grade = grade(this.sumScore.num);
      }
    },

    // 提交表单
    async submitFrom() {
      if (!this.message) {
        this.$toast.fail("请填写备注");
        return;
      }
      let examineList = this.senseOfWorth.concat(this.jobPerformance);
      const checkFromRes = await this.checkFrom(examineList);
      if (!checkFromRes.isPass) {
        this.$toast.fail(checkFromRes.errorMsg);
        return;
      }
      const alertRes = await this.$alert("此操作将进行自评提交");
      if (!alertRes) {
        return;
      }
      let subData = {
        recordId: this.query.recordId, //审批流程id
        status: 1, //"审批状态： 1通过 2 驳回
        moduleId: this.query.id, //考核审批的id
        quarter_id: this.query.quarter_id,
        message: this.message, //审批意见
        markList: ""
      };

      let markList = [];
      examineList.map(item => {
        item.markList.map(markListItem => {
          if (markListItem.readonlyNo) {
            let obj = {
              examine_id: item.examine_id, //考核id
              examineb_id: item.id, //题目表id
              messge: markListItem.messge, //评价
              score: markListItem.score, //得分
              user_id: this.query.user_id, //评价人id
              user_name: this.query.user_name //评价人名称
              // score_type: 1 //评价类型：0-自评，1-他人评价
            };
            markList.push(obj);
          }
        });
      });
      subData.markList = JSON.stringify(markList);
      console.log(subData);
      //审核操作
      this.$store.state.loading = true;
      this.$store.state.loadingText = "提交数据中";
      const { success = false } = await service.scoreApproval_audit(subData);
      this.$store.state.loading = false;
      if (success) {
        this.$toast.success("提交成功");
        this.$goBack();
      }
    },
    // 检查表单
    checkFrom(arr) {
      let value = {
        isPass: true,
        errorMsg: ""
      };
      for (let i = 0; i < arr.length; i++) {
        for (let index = 0; index < arr[i].markList.length; index++) {
          const element = arr[i].markList[index];
          if (element.readonlyNo) {
            const { messge, score } = element;
            if (!messge) {
              value.isPass = false;
              value.errorMsg = "请输入评价";
              break;
            }
            if (!score) {
              value.isPass = false;
              value.errorMsg = "请输入评分";
              break;
            }

            if (score < 1 || score > 100) {
              value.isPass = false;
              value.errorMsg = "请输入1-100之间的数字(评分)";
              break;
            }
          }
        }
      }
      return new Promise(resolve => {
        resolve(value);
      });
    },
    //  初始化当前进度
    initProcessActive() {
      if (
        !this.quarterInfo.approval_process.scoreApprovepsn ||
        !this.quarterInfo.approval_process.scoreApprovepsn.length
      ) {
        return 0;
      }
      let array = this.quarterInfo.approval_process.scoreApprovepsn;
      let value = 0;
      for (let index = 0; index < array.length; index++) {
        const element = array[index];
        if (element.status && element.status != 0) {
          value = index + 1;
        }
      }
      return value;
    },
    // 等级初始化
    gradeInit(me_score) {
      return grade(me_score);
    }
  }
};
</script>

<style scoped>
@import "./../../../components/public.css";
.rulePart-con-hide {
  height: 42px;
  overflow: hidden;
}
.score_con_box {
  width: 100%;
  height: auto;
  background: #fff;
  text-align: left;
  padding: 0px 16px 10px 16px;
  color: #000;
}
</style>